home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / src / gas-211 / gas / config / coff_gnu.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-30  |  26.0 KB  |  856 lines

  1. /* coff_gnu.h
  2.    Copyright (C) 1987, 1992 Free Software Foundation, Inc.
  3.  
  4.    This file is part of GAS, the GNU Assembler.
  5.  
  6.    GAS is free software; you can redistribute it and/or modify
  7.    it under the terms of the GNU General Public License as published by
  8.    the Free Software Foundation; either version 2, or (at your option)
  9.    any later version.
  10.  
  11.    GAS is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU General Public License
  17.    along with GAS; see the file COPYING.  If not, write to
  18.    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /*
  21.  * At this point I'm sure this file is right for i960 and I'm pretty sure it's
  22.  * right for a29k, although it hasn't been tested rigorously.  Please feel free
  23.  * to add your own machine's description here.  Without that info, it isn't
  24.  * possible to build cross development tools from elsewhere nor is it easy to
  25.  * continue to support your machines format.
  26.  *
  27.  * The TC_foo ifdef's are mine.  They are what gas uses.  The other ifdef's
  28.  * remain for documentation from other scavenged files.   xoxorich.
  29.  */
  30.  
  31. /********************** FILE HEADER **********************/
  32.  
  33. struct filehdr
  34.   {
  35.     unsigned short f_magic;    /* magic number            */
  36.     unsigned short f_nscns;    /* number of sections        */
  37.     long f_timdat;        /* time & date stamp        */
  38.     long f_symptr;        /* file pointer to symtab    */
  39.     long f_nsyms;        /* number of symtab entries    */
  40.     unsigned short f_opthdr;    /* sizeof(optional hdr)        */
  41.     unsigned short f_flags;    /* flags            */
  42.   };
  43.  
  44. /* Bits for f_flags:
  45.  *    F_RELFLG    relocation info stripped from file
  46.  *    F_EXEC        file is executable (no unresolved externel references)
  47.  *    F_LNNO        line nunbers stripped from file
  48.  *    F_LSYMS        local symbols stripped from file
  49.  *    F_AR32WR    file has byte ordering of an AR32WR machine (e.g. vax)
  50.  */
  51. #define F_RELFLG    (0x0001)
  52. #define F_EXEC        (0x0002)
  53. #define F_LNNO        (0x0004)
  54. #define F_LSYMS        (0x0008)
  55.  
  56. #ifdef TC_I960
  57. #define F_AR32WR    (0x0010)/* File has 32 bits per word, least
  58.                     significant byte first. */
  59. #else /* TC_I960 */
  60. #define F_AR32WR    (0x0100)
  61. #endif /* TC_I960 */
  62.  
  63. #define F_MINMAL    (0x0010)/* ??? */
  64. #define F_UPDATE    (0x0020)/* ??? */
  65. #define F_SWABD        (0x0040)/* ??? */
  66. #define F_AR16WR    (0x0080)/* File has the byte ordering used by
  67.                     the PDP*-11/70 processor. */
  68. #define F_AR32W        (0x0200)/* File has 32 bits per word, most
  69.                     significant byte first. */
  70.  
  71. /*
  72.  *    Intel 80960 (I960) processor flags.
  73.  *    F_I960TYPE == mask for processor type field.
  74.  */
  75.  
  76. #define    F_I960TYPE    (0xf000)
  77. #define    F_I960CORE    (0x1000)
  78. #define    F_I960KB    (0x2000)
  79. #define    F_I960SB    (0x2000)
  80. #define    F_I960MC    (0x3000)
  81. #define    F_I960XA    (0x4000)
  82. #define    F_I960CA    (0x5000)
  83. #define    F_I960KA    (0x6000)
  84. #define    F_I960SA    (0x6000)
  85.  
  86. /*
  87.  * i80960 Magic Numbers
  88.  */
  89.  
  90. #define I960ROMAGIC    (0x160)    /* read-only text segments */
  91. #define I960RWMAGIC    (0x161)    /* read-write text segments */
  92.  
  93. #define I960BADMAG(x) (((x).f_magic != I960ROMAGIC) && ((x).f_magic != I960RWMAGIC))
  94.  
  95. #define    SIPFBOMAGIC    (0x17a)    /* Am29000 (Byte 0 is MSB - Big Endian) */
  96. #define    SIPRBOMAGIC    (0x17b)    /* Am29000 (Byte 0 is LSB - Little Endian) */
  97.  
  98. #define A29KBADMAG(x)    (((x).f_magic != SIPFBOMAGIC) && ((x).f_magic != SIPRBOMAGIC))
  99.  
  100. #ifdef TE_I386AIX
  101. # define I386MAGIC    (0x175)    /* Danbury AIX C compiler     */
  102. # define I386SVMAGIC    (0x14c)    /* System V C Compiler         */
  103. # define I386BADMAG(x)  (((x).f_magic!=I386MAGIC) && \
  104.              ((x).f_magic!=I386SVMAGIC))
  105. #else /* not TE_I386AIX */
  106. # define I386MAGIC    0x14c
  107. # define I386BADMAG(x) (((x).f_magic!=I386MAGIC))
  108. #endif /* not TE_I386AIX */
  109.  
  110.  
  111. #define    FILHDR    struct filehdr
  112. #define    FILHSZ    sizeof(FILHDR)
  113.  
  114.  
  115. /********************** AOUT "OPTIONAL HEADER" **********************/
  116.  
  117. typedef struct
  118.   {
  119.     unsigned long phys_addr;
  120.     unsigned long bitarray;
  121.   }
  122.  
  123. TAGBITS;
  124.  
  125. /*  These appear to be used only by exec(2).  I don't know who cares
  126.     about them in a cross development environment.  In any case, this
  127.     is my collection after researching the issue for a few hours.
  128.     Apparently, most have these have remained essentially unchanged
  129.     since v7 days, although a few new ones have been added.  xoxorich. */
  130.  
  131. #define BAD0MAGIC    (0401)    /* (?) "lpd (UNIX/RT)" */
  132. #define BAD1MAGIC    (0405)    /* (?) overlay */
  133. #define    OMAGIC        (0407)    /* old impure format. data immediately
  134.                   follows text. both sections are rw. */
  135. #define    NMAGIC        (0410)    /* split i&d, read-only text */
  136. #define A_MAGIC3    (0411)    /* (?) "separated I&D" */
  137. #define    ZMAGIC        (0413)    /* like NMAGIC, but demand loaded */
  138. #define PAGEMAGIC2    (0414)    /* (?) like ZMAGIC, but address zero
  139.                   explicitly unmapped. */
  140. #define REGMAGIC    (0414)    /* (?) a PAGEMAGIC2 alias? */
  141. #define PAGEMAGIC3    (0415)    /* (?) like ZMAGIC, but address zero mapped. */
  142. #define A_MAGIC5    (0437)    /* (?) "system overlay, separated I&D" */
  143. /* intended for non-unix cross development */
  144. #define SASMAGIC    (010000)/* Single Address Space */
  145. #define MASMAGIC    (020000)/* (?) "Multiple (separate I & D) Address Spaces" */
  146.  
  147. typedef struct aouthdr
  148.   {
  149.     short magic;        /* type of file                */
  150.     short vstamp;        /* version stamp            */
  151.     unsigned long tsize;    /* text size in bytes, padded to FW bdry*/
  152.     unsigned long dsize;    /* initialized data "  "        */
  153.     unsigned long bsize;    /* uninitialized data "   "        */
  154. #if U3B
  155.     unsigned long dum1;
  156.     unsigned long dum2;        /* pad to entry point    */
  157. #endif
  158.     unsigned long entry;    /* entry pt.                */
  159.     unsigned long text_start;    /* base of text used for this file */
  160.     unsigned long data_start;    /* base of data used for this file */
  161.     /* CAREFUL: some formats omit the tagentries member. */
  162.     unsigned long tagentries;    /* number of tag entries to
  163.                        follow (always zero for i960) */
  164.   }
  165.  
  166. AOUTHDR;
  167.  
  168. /* return a pointer to the tag bits array */
  169.  
  170. #define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1))
  171.  
  172. /* compute size of a header */
  173.  
  174. /*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/
  175. #define AOUTSZ (sizeof(AOUTHDR))
  176.  
  177.  
  178. /********************** STORAGE CLASSES **********************/
  179.  
  180. #define C_EFCN        -1    /* physical end of function */
  181. #define C_NULL        0
  182. #define C_AUTO        1    /* automatic variable */
  183. #define C_EXT        2    /* external symbol */
  184. #define C_STAT        3    /* static */
  185. #define C_REG        4    /* register variable */
  186. #define C_EXTDEF    5    /* external definition */
  187. #define C_LABEL        6    /* label */
  188. #define C_ULABEL    7    /* undefined label */
  189. #define C_MOS        8    /* member of structure */
  190. #define C_ARG        9    /* function argument */
  191. #define C_STRTAG    10    /* structure tag */
  192. #define C_MOU        11    /* member of union */
  193. #define C_UNTAG        12    /* union tag */
  194. #define C_TPDEF        13    /* type definition */
  195. #define C_USTATIC    14    /* undefined static */
  196. #define C_ENTAG        15    /* enumeration tag */
  197. #define C_MOE        16    /* member of enumeration */
  198. #define C_REGPARM    17    /* register parameter */
  199. #define C_FIELD        18    /* bit field */
  200.  
  201. #ifdef TC_I960
  202. #define C_AUTOARG    19    /* auto argument */
  203. #define C_LASTENT    20    /* dummy entry (end of block) */
  204. #endif /* TC_I960 */
  205.  
  206. #ifdef TC_A29K
  207. #define C_GLBLREG    19    /* global register */
  208. #define C_EXTREG    20    /* external global register */
  209. #define    C_DEFREG    21    /* ext. def. of global register */
  210. #define C_STARTOF    22    /* as29 $SIZEOF and $STARTOF symbols */
  211. #endif /* TC_A29K */
  212.  
  213. #define C_BLOCK        100    /* ".bb" or ".eb" */
  214. #define C_FCN        101    /* ".bf" or ".ef" */
  215. #define C_EOS        102    /* end of structure */
  216. #define C_FILE        103    /* file name */
  217. #define C_LINE        104    /* line # reformatted as symbol table entry */
  218. #define C_ALIAS         105    /* duplicate tag */
  219. #define C_HIDDEN    106    /* ext symbol in dmert public lib. like static,
  220.                    used to avoid name conflicts. */
  221.  
  222. #ifdef TC_I960
  223. /* New storage classes for 80960 */
  224. #define C_SCALL        107    /* Procedure reachable via system call    */
  225. /* C_LEAFPROC is obsolete.  Use C_LEAFEXT or C_LEAFSTAT */
  226. #define C_LEAFPROC    108    /* Leaf procedure, "call" via BAL */
  227. #define C_LEAFEXT       108
  228. #define C_OPTVAR    109    /* Optimized variable */
  229. #define C_DEFINE    110    /* Preprocessor #define */
  230. #define C_PRAGMA    111    /* Advice to compiler or linker    */
  231. #define C_SEGMENT    112    /* 80960 segment name */
  232. #define C_LEAFSTAT      113    /* Static leaf */
  233. #endif /* TC_I960 */
  234.  
  235. #ifdef TC_A29K
  236. #define C_SHADOW    107    /* shadow symbol */
  237. #endif /* TC_A29K */
  238.  
  239. /********************** SECTION HEADER **********************/
  240.  
  241. struct scnhdr
  242.   {
  243.     char s_name[8];        /* section name */
  244.     long s_paddr;        /* physical address, aliased s_nlib */
  245.     long s_vaddr;        /* virtual address */
  246.     long s_size;        /* section size */
  247.     long s_scnptr;        /* file ptr to raw data for section */
  248.     long s_relptr;        /* file ptr to relocation */
  249.     long s_lnnoptr;        /* file ptr to line numbers */
  250.     unsigned short s_nreloc;    /* number of relocation entries    */
  251.     unsigned short s_nlnno;    /* number of line number entries */
  252.     long s_flags;        /* flags */
  253.  
  254. #ifdef TC_I960
  255.     unsigned long s_align;    /* section alignment */
  256. #endif /* TC_I960 */
  257.   };
  258.  
  259. #define    SCNHDR    struct scnhdr
  260. #define    SCNHSZ    sizeof(SCNHDR)
  261.  
  262. /*
  263.  * names of "special" sections
  264.  */
  265. #define _TEXT    ".text"    /* executable code section    */
  266. #define _DATA    ".data"    /* initialized data        */
  267. #define _BSS     ".bss"        /* un-initialized data        */
  268. #define _DEBUG   ".debug"    /* special section used by dbx    */
  269. #define _COMMENT ".comment"    /* version info            */
  270. #define _LIB     ".lib"        /* shared lib info section    */
  271. #define _TV      ".tv"
  272.  
  273. /*
  274.  * s_flags "type"
  275.  */
  276.  
  277. /*
  278.  * In instances where it is necessary for a linker to
  279.  * produce an output file which contains text or data not
  280.  * based at virtual address 0, e.g. for a ROM, then the
  281.  * linker should accept address base information as command
  282.  * input and use PAD sections to skip over unused addresses.
  283.  * (at least for a29k.  Maybe others.)
  284.  */
  285.  
  286. #define STYP_REG     (0x0000)    /* "regular" section: allocated, relocated, loaded */
  287. #define STYP_DSECT     (0x0001)    /* "dummy" section: not allocated, relocated, not loaded */
  288. #define STYP_NOLOAD     (0x0002)    /* "noload" section: allocated, relocated, not loaded */
  289. #define STYP_GROUP     (0x0004)    /* "grouped" section: formed of input sections */
  290. #define STYP_PAD     (0x0008)    /* "padding" section: not allocated, not relocated, loaded */
  291. #define STYP_COPY     (0x0010)    /* "copy" section: for decision function used by field update;  not allocated, not relocated,
  292.                      loaded; reloc & lineno entries processed normally */
  293. #define STYP_TEXT     (0x0020)    /* section contains text only */
  294. #define S_SHRSEG     (0x0020)    /* In 3b Update files (output of ogen), sections which appear in SHARED segments of the Pfile
  295.                      will have the S_SHRSEG flag set by ogen, to inform dufr that updating 1 copy of the proc. will
  296.                      update all process invocations. */
  297. #define STYP_DATA     (0x0040)    /* section contains data only */
  298. #define STYP_BSS     (0x0080)    /* section contains bss only */
  299. #define S_NEWFCN     (0x0100)    /* In a minimal file or an update file, a new function (as compared with a replaced function) */
  300. #define STYP_INFO     (0x0200)    /* comment section : not allocated not relocated, not loaded */
  301. #define STYP_OVER     (0x0400)    /* overlay section : relocated not allocated or loaded */
  302. #define STYP_LIB     (0x0800)    /* for .lib section : same as INFO */
  303. #define STYP_MERGE     (0x2000)    /* merge section -- combines with text, data or bss sections only */
  304. #define STYP_REVERSE_PAD (0x4000)    /* section will be padded with no-op instructions wherever padding is necessary and there is a
  305.                      word of contiguous bytes beginning on a word boundary. */
  306.  
  307. #ifdef TC_A29K
  308. /* NOTE:  The use of STYP_BSSREG for relocation is not yet defined. */
  309. #define    STYP_BSSREG    0x1200    /* Global register area (like STYP_INFO) */
  310. #define STYP_ENVIR    0x2200    /* Environment (like STYP_INFO) */
  311. #define STYP_ABS    0x4000    /* Absolute (allocated, not reloc, loaded) */
  312. #define STYP_LIT    0x8020    /* Literal data (like STYP_TEXT) */
  313. #endif /* TC_A29K */
  314.  
  315. /********************** LINE NUMBERS **********************/
  316.  
  317. /* 1 line number entry for every "breakpointable" source line in a section.
  318.  * Line numbers are grouped on a per function basis; first entry in a function
  319.  * grouping will have l_lnno = 0 and in place of physical address will be the
  320.  * symbol table index of the function name.
  321.  */
  322. struct lineno
  323.   {
  324.     union
  325.       {
  326.     long l_symndx;        /* symbol index of function name, iff l_lnno == 0*/
  327.     long l_paddr;        /* (physical) address of line number */
  328.       }
  329.     l_addr;
  330.     unsigned short l_lnno;    /* line number */
  331. #ifdef TC_I960
  332.     /* not used on a29k */
  333.     char padding[2];        /* force alignment */
  334. #endif /* TC_I960 */
  335.   };
  336.  
  337. #define    LINENO    struct lineno
  338. #define    LINESZ    sizeof(LINENO)
  339.  
  340.  
  341. /********************** SYMBOLS **********************/
  342.  
  343. #define SYMNMLEN    8    /* # characters in a symbol name */
  344. #define FILNMLEN    14    /* # characters in a file name */
  345. #define DIMNUM        4    /* # array dimensions in auxiliary entry */
  346.  
  347. struct syment
  348.   {
  349.     union
  350.       {
  351.     char _n_name[SYMNMLEN];    /* old COFF version */
  352.     struct
  353.       {
  354.         long _n_zeroes;    /* new == 0 */
  355.         long _n_offset;    /* offset into string table */
  356.       }
  357.     _n_n;
  358.     char *_n_nptr[2];    /* allows for overlaying */
  359.       }
  360.     _n;
  361.     long n_value;        /* value of symbol */
  362.     short n_scnum;        /* section number */
  363.  
  364. #ifdef TC_I960
  365.     /* This isn't yet used on the i960.  In some formats this
  366.        is two bytes of padding.  In others, it is missing entirely. */
  367.     unsigned short n_flags;    /* copy of flags from filhdr */
  368. #endif /* TC_I960 */
  369.  
  370. #ifdef TC_A29K
  371.     unsigned short n_type;    /* type and derived type */
  372. #else /* TC_A29K */
  373.     /* at least i960 uses long */
  374.     unsigned long n_type;    /* type and derived type */
  375. #endif /* TC_A29K */
  376.  
  377.     char n_sclass;        /* storage class */
  378.     char n_numaux;        /* number of aux. entries */
  379.  
  380. #ifndef TC_A29K
  381.     char pad2[2];        /* force alignment */
  382. #endif /* TC_A29K */
  383.   };
  384.  
  385. #define    SYMENT    struct syment
  386. #define    SYMESZ    sizeof(SYMENT)    /* This had better also be sizeof(AUXENT) */
  387.  
  388. #define n_name        _n._n_name
  389. #define n_ptr        _n._n_nptr[1]
  390. #define n_zeroes    _n._n_n._n_zeroes
  391. #define n_offset    _n._n_n._n_offset
  392.  
  393. /*
  394.      * Relocatable symbols have number of the section in which they are defined,
  395.      * or one of the following:
  396.      */
  397.  
  398. #define N_SCNUM    ((short) 1-65535)    /* section num where symbol defined */
  399. #define N_UNDEF    ((short)0)    /* undefined symbol */
  400. #define N_ABS    ((short)-1)    /* value of symbol is absolute */
  401. #define N_DEBUG    ((short)-2)    /* debugging symbol -- symbol value is meaningless */
  402. #define N_TV    ((short)-3)    /* indicates symbol needs preload transfer vector */
  403. #define P_TV    ((short)-4)    /* indicates symbol needs transfer vector (postload) */
  404.  
  405. /*
  406.  * Type of a symbol, in low 4 bits of the word
  407.  */
  408. #define T_NULL        0    /* type not assigned */
  409. #define T_VOID        1    /* function argument (only used by compiler) (but now real void). */
  410. #define T_CHAR        2    /* character */
  411. #define T_SHORT        3    /* short integer */
  412. #define T_INT        4    /* integer */
  413. #define T_LONG        5    /* long integer */
  414. #define T_FLOAT        6    /* floating point */
  415. #define T_DOUBLE    7    /* double word */
  416. #define T_STRUCT    8    /* structure */
  417. #define T_UNION        9    /* union */
  418. #define T_ENUM        10    /* enumeration */
  419. #define T_MOE        11    /* member of enumeration */
  420. #define T_UCHAR        12    /* unsigned character */
  421. #define T_USHORT    13    /* unsigned short */
  422. #define T_UINT        14    /* unsigned integer */
  423. #define T_ULONG        15    /* unsigned long */
  424.  
  425. #ifdef TC_I960
  426. #define T_LNGDBL    16    /* long double */
  427. #endif /* TC_I960 */
  428.  
  429. /*
  430.  * derived types, in n_type
  431.  */
  432. #define DT_NON        (0)    /* no derived type */
  433. #define DT_PTR        (1)    /* pointer */
  434. #define DT_FCN        (2)    /* function */
  435. #define DT_ARY        (3)    /* array */
  436.  
  437. #ifndef TC_I960
  438.  
  439. #define N_BTMASK    (0x0f)
  440. #define N_TMASK        (0x30)
  441. #define N_BTSHFT    (4)
  442. #define N_TSHIFT    (2)
  443.  
  444. #else /* TC_I960 */
  445.  
  446. #define N_BTMASK    (0x1f)
  447. #define N_TMASK        (0x60)
  448. #define N_BTSHFT    (5)
  449. #define N_TSHIFT    (2)
  450.  
  451. #endif /* TC_I960 */
  452.  
  453. #define BTYPE(x)    ((x) & N_BTMASK)
  454.  
  455. #define ISPTR(x)    (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
  456. #define ISFCN(x)    (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
  457. #define ISARY(x)    (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
  458.  
  459. #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
  460.  
  461. union auxent
  462.   {
  463.     struct
  464.       {
  465.     long x_tagndx;        /* str, un, or enum tag indx */
  466.     union
  467.       {
  468.         struct
  469.           {
  470.         unsigned short x_lnno;    /* declaration line number */
  471.         unsigned short x_size;    /* str/union/array size */
  472.           }
  473.         x_lnsz;
  474.         long x_fsize;    /* size of function */
  475.       }
  476.     x_misc;
  477.     union
  478.       {
  479.         struct
  480.           {            /* if ISFCN, tag, or .bb */
  481.         long x_lnnoptr;    /* ptr to fcn line # */
  482.         long x_endndx;    /* entry ndx past block end */
  483.           }
  484.         x_fcn;
  485.         struct
  486.           {            /* if ISARY, up to 4 dimen. */
  487.         unsigned short x_dimen[DIMNUM];
  488.           }
  489.         x_ary;
  490.       }
  491.     x_fcnary;
  492.     unsigned short x_tvndx;    /* tv index */
  493.       }
  494.     x_sym;
  495.  
  496.     /* This was just a struct x_file with x_fname only in a29k.  xoxorich. */
  497.     union
  498.       {
  499.     char x_fname[FILNMLEN];
  500.     struct
  501.       {
  502.         long x_zeroes;
  503.         long x_offset;
  504.       }
  505.     x_n;
  506.       }
  507.     x_file;
  508.  
  509.     struct
  510.       {
  511.     long x_scnlen;        /* section length */
  512.     unsigned short x_nreloc;/* # relocation entries */
  513.     unsigned short x_nlinno;/* # line numbers */
  514.       }
  515.     x_scn;
  516.  
  517.     struct
  518.       {
  519.     long x_tvfill;        /* tv fill value */
  520.     unsigned short x_tvlen;    /* length of .tv */
  521.  
  522.     /* This field was typo'd x_tvrna on a29k. xoxorich. */
  523.     unsigned short x_tvran[2];    /* tv range */
  524.       }
  525.     x_tv;            /* info about .tv section (in auxent of symbol .tv)) */
  526.  
  527. #ifdef TC_I960
  528.     /******************************************
  529.      *  I960-specific *2nd* aux. entry formats
  530.      ******************************************/
  531.     struct
  532.       {
  533.     /* This is a very old typo that keeps getting propogated. */
  534. #define x_stdindx x_stindx
  535.     long x_stindx;        /* sys. table entry */
  536.       }
  537.     x_sc;            /* system call entry */
  538.  
  539.     struct
  540.       {
  541.     unsigned long x_balntry;/* BAL entry point */
  542.       }
  543.     x_bal;            /* BAL-callable function */
  544.  
  545.     struct
  546.       {
  547.     unsigned long x_timestamp;    /* time stamp */
  548.     char x_idstring[20];    /* producer identity string */
  549.       }
  550.     x_ident;            /* Producer ident info */
  551.  
  552.     char a[sizeof (struct syment)];    /* force auxent/syment sizes to match */
  553. #endif /* TC_I960 */
  554.   };
  555.  
  556. #define    AUXENT    union auxent
  557. #define    AUXESZ    sizeof(AUXENT)    /* This had better also be sizeof(SYMENT) */
  558.  
  559. #if VAX || I960
  560. #    define _ETEXT    "_etext"
  561. #else
  562. #    define _ETEXT    "etext"
  563. #endif
  564.  
  565. /********************** RELOCATION DIRECTIVES **********************/
  566.  
  567. struct reloc
  568.   {
  569.     long r_vaddr;        /* Virtual address of reference */
  570.     long r_symndx;        /* Index into symbol table */
  571.     unsigned short r_type;    /* Relocation type */
  572. #ifdef TC_I960
  573.     /* not used for a29k */
  574.     char pad[2];        /* Unused */
  575. #endif /* TC_I960 */
  576.   };
  577.  
  578. #define RELOC struct reloc
  579. #define RELSZ sizeof(RELOC)
  580.  
  581. #define    R_ABS        (0x00)    /* reference is absolute */
  582.  
  583. #ifdef TC_I860
  584. #define RM_DIR32    (0x06)
  585. #define R_IPAIR        (0x1c)
  586. #define R_N10PAIR    (0x1d)
  587. #define R_N10HIGH    (0x1e)
  588. #define R_N10LOW0    (0x1f)
  589. #define R_N10LOW1    (0x20)
  590. #define R_N10LOW2    (0x21)
  591. #define R_N10LOW3    (0x22)
  592. #define R_N10LOW4    (0x23)
  593. #define R_N10SPLIT0    (0x24)
  594. #define R_N10SPLIT1    (0x25)
  595. #define R_N10SPLIT2    (0x26)
  596. #define R_N10HIGHADJ    (0x27)
  597. #define R_N10BRADDR    (0x28)
  598. #endif /* TC_I860 */
  599.  
  600. #ifdef TC_I960
  601. #define R_RELLONG    (0x11)    /* Direct 32-bit relocation */
  602. #define R_IPRSHORT    (0x18)
  603. #define R_IPRMED     (0x19)    /* 24-bit ip-relative relocation */
  604. #define R_IPRLONG    (0x1a)
  605. #define R_OPTCALL    (0x1b)    /* 32-bit optimizable call (leafproc/sysproc) */
  606. #define R_OPTCALLX    (0x1c)    /* 64-bit optimizable call (leafproc/sysproc) */
  607. #define R_GETSEG    (0x1d)
  608. #define R_GETPA        (0x1e)
  609. #define R_TAGWORD    (0x1f)
  610. #endif /* TC_I960 */
  611.  
  612. #ifdef TC_A29K
  613. /*
  614.  * NOTE: All the "I" forms refer to Am29000 instruction
  615.  * formats.  The linker is expected to know how the numeric
  616.  * information is split and/or aligned within the
  617.  * instruction word(s).  R_BYTE works for instructions, too.
  618.  *
  619.  * If the parameter to a CONSTH instruction is a relocatable
  620.  * type, two relocation records are written.  The first has
  621.  * an r_type of R_IHIHALF (33 octal) and a normal r_vaddr
  622.  * and r_symndx.  The second relocation record has an r_type
  623.  * of R_IHCONST (34 octal), a normal r_vaddr (which is
  624.  * redundant), and an r_symndx containing the 32-bit
  625.  * constant offset to the relocation instead of the actual
  626.  * symbol table index.  This second record is always
  627.  * written, even if the constant offset is zero.  The
  628.  * constant fields of the instruction are set to zero.
  629.  */
  630.  
  631. #define    R_IREL        (0x18)    /* instruction relative (jmp/call) */
  632. #define    R_IABS        (0x19)    /* instruction absolute (jmp/call) */
  633. #define    R_ILOHALF    (0x1a)    /* instruction low half  (const)  */
  634. #define    R_IHIHALF    (0x1b)    /* instruction high half (consth) part 1 */
  635. #define    R_IHCONST    (0x1c)    /* instruction high half (consth) part 2
  636.                   constant offset of R_IHIHALF relocation */
  637. #define    R_BYTE        (0x1d)    /* relocatable byte value */
  638. #define R_HWORD        (0x1e)    /* relocatable halfword value */
  639. #define R_WORD        (0x1f)    /* relocatable word value */
  640. #define    R_IGLBLRC    (0x20)    /* instruction global register RC */
  641. #define    R_IGLBLRA    (0x21)    /* instruction global register RA */
  642. #define    R_IGLBLRB    (0x22)    /* instruction global register RB */
  643. #endif /* TC_A29K */
  644.  
  645.  
  646. #define DEFAULT_DATA_SECTION_ALIGNMENT 4
  647. #define DEFAULT_BSS_SECTION_ALIGNMENT 4
  648. #define DEFAULT_TEXT_SECTION_ALIGNMENT 16
  649. /* For new sections we haven't heard of before */
  650. #define DEFAULT_SECTION_ALIGNMENT 4
  651.  
  652. #if defined(TC_I386)
  653. /*
  654.  * X86 generic
  655.  *    8-bit offset reference in 8-bits
  656.  *    8-bit offset reference in 16-bits
  657.  *    12-bit segment reference
  658.  *    auxiliary relocation entry
  659.  */
  660. #define    R_OFF8        07
  661. #define R_OFF16        010
  662. #define    R_SEG12        011
  663. #define    R_AUX        013
  664.  
  665. /*
  666.  * B16 and X86 generics
  667.  *    16-bit direct reference
  668.  *    16-bit "relative" reference
  669.  *    16-bit "indirect" (TV) reference
  670.  */
  671. #define  R_DIR16    01
  672. #define  R_REL16    02
  673. #define  R_IND16    03
  674.  
  675. /*
  676.  * 3B generic
  677.  *    24-bit direct reference
  678.  *    24-bit "relative" reference
  679.  *    16-bit optimized "indirect" TV reference
  680.  *    24-bit "indirect" TV reference
  681.  *    32-bit "indirect" TV reference
  682.  */
  683. #define  R_DIR24    04
  684. #define  R_REL24    05
  685. #define  R_OPT16    014
  686. #define  R_IND24    015
  687. #define  R_IND32    016
  688.  
  689. /*
  690.  * XL generics
  691.  *    10-bit direct reference
  692.  *    10-bit "relative" reference
  693.  *    32-bit "relative" reference
  694.  */
  695. #define    R_DIR10        025
  696. #define R_REL10        026
  697. #define R_REL32        027
  698.  
  699. /*
  700.  * 3B and M32 generics
  701.  *    32-bit direct reference
  702.  */
  703. #define  R_DIR32    06
  704.  
  705. /*
  706.  * M32 generic
  707.  *    32-bit direct reference with bytes swapped
  708.  */
  709. #define  R_DIR32S    012
  710.  
  711. #endif /* TC_I386 */
  712.  
  713. #if defined(TE_I386AIX)
  714.  
  715. #define UINFOSIZ        64    /* size of user info buffer */
  716. typedef char uinfo_t[UINFOSIZ];
  717.  
  718. struct env387
  719.   {
  720.     unsigned short control;
  721.     unsigned short r0;
  722.     unsigned short status;
  723.     unsigned short r1;
  724.     unsigned short tag;
  725.     unsigned short r2;
  726.     unsigned long eip;
  727.     unsigned short code_seg;
  728.     unsigned short opcode;
  729.     unsigned long operand;
  730.     unsigned short operand_seg;
  731.     unsigned short r3;
  732.     unsigned char regs[8][10];
  733.   };
  734.  
  735. #define    CD_NAMELEN 16        /* length of most names in this header */
  736. #define    CORHDRSIZ    2048    /* size to which header is padded out */
  737. #define    MAX_CORE_SEGS    32    /* maximum segments in a core dump */
  738. #define NUM_FREGS    1    /* # of saved FP regs */
  739.  
  740. /*
  741.  * These are defined such that 286 and 386 kernels can produce
  742.  * compatible dumps.
  743.  */
  744. #define CD_AX    0
  745. #define CD_BX    1
  746. #define CD_CX    2
  747. #define CD_DX    3
  748. #define CD_SI    4
  749. #define CD_DI    5
  750. #define CD_BP    6
  751. #define CD_SP    7
  752. #define CD_FL    8
  753. #define CD_IP    9
  754. #define CD_CS    10
  755. #define CD_DS    11
  756. #define CD_ES    12
  757. #define CD_FS    13
  758. #define CD_GS    14
  759. #define CD_SS    15
  760. #define NUM_REGS    16
  761.  
  762. #ifndef SPATHLEN
  763. # define SPATHLEN 16        /* sys/param.h */
  764. #endif
  765. #ifndef NSIG
  766. # define NSIG 63        /* sys/signal.h */
  767. # define SIGSETSZ ((NSIG+31)/32)
  768. typedef struct ksigmask
  769.   {
  770.     unsigned long sigs[SIGSETSZ];
  771.   }
  772.  
  773. ksigmask_t;
  774. #endif
  775.  
  776. struct corehdr
  777.   {
  778.     char cd_magic[4];        /* COR_MAGIC = "core" */
  779.  
  780.     /* general information about the dump itself */
  781.     struct dumpseg
  782.       {                /* table of contents for dump */
  783.     long cs_type;        /* seg. type; see below */
  784.     long cs_len;        /* length (in bytes) of segment */
  785.     long cs_offset;        /* offset (in dump) of segment */
  786.     long cs_address;    /* address segment had in mem */
  787.       }
  788.     cd_segs[MAX_CORE_SEGS];
  789.  
  790.     /* general information about the process */
  791.     char cd_comm[CD_NAMELEN];    /* command being run */
  792.     char cd_mach[CD_NAMELEN];    /* type of machine it ran on */
  793.     char cd_site[CD_NAMELEN];    /* name of site it ran on */
  794.     long cd_ldtype;        /* type of load module running */
  795.     char cd_intsize;        /* sizeof(int) */
  796.     char cd_dptrsize;        /* sizeof(char *) */
  797.     char cd_tptrsize;        /* sizeof(int (*)()) */
  798.     char cd_unused;
  799.  
  800.     /* user-mode program state */
  801.     long cd_regs[NUM_REGS];    /* user-mode general registers    */
  802.     struct env387 cd_fpregs;    /* user-mode floating-point state */
  803.  
  804.     /* kernel-mode program state */
  805.     int (*cd_sig[NSIG]) ();    /* disposition of signals */
  806.     ksigmask_t cd_sigmask;    /* signals to be blocked    */
  807.     ksigmask_t cd_sigpend;    /* signals currently pending */
  808.     long cd_cursig;        /* signal that caused the dump */
  809.  
  810.     long cd_pid;        /* process ID of the corpse */
  811.     long cd_ppid;        /* parent process ID of corpse */
  812.     short cd_uid;        /* process effective user ID */
  813.     short cd_ruid;        /* process real user ID */
  814.     short cd_gid;        /* process effective group ID */
  815.     short cd_rgid;        /* process real group ID    */
  816.  
  817.     uinfo_t cd_uinfo;        /* buffer of user information    */
  818.     char cd_locname[32];    /* name of /local */
  819.     char cd_uvers[CD_NAMELEN];    /* user version string */
  820.     unsigned short cd_spath[SPATHLEN];    /* sitepath */
  821.   };
  822.  
  823. #ifndef NOCHECKS
  824. /* this will generate an error if sizeof(struct corehdr) > CORHDRSIZ */
  825. struct
  826.   {
  827.     char xxcdxx[CORHDRSIZ + 1 - sizeof (struct corehdr)];
  828.   };
  829.  
  830. #endif /* ! NOCHECKS */
  831.  
  832. /*
  833.  * segment types (in cs_type)
  834.  *    each segment in the address space appears here, whether or not it
  835.  *    is actually dumped.  Read/only segments will not actually be dumped.
  836.  *    A segment that is not in the dump will have a cs_offset of zero.
  837.  */
  838. #define    COR_TYPE_CODE        'x'    /* process code - NOT IN DUMP    */
  839. #define    COR_TYPE_DATA        'd'    /* process data segment        */
  840. #define    COR_TYPE_STACK        's'    /* process stack segment    */
  841. #define COR_TYPE_LIBCODE    'X'    /* shared lib code - NOT IN DUMP*/
  842. #define COR_TYPE_LIBDATA    'D'    /* shared lib data        */
  843. #define COR_TYPE_READ        'r'    /* other read/only - NOT IN DUMP*/
  844. #define COR_TYPE_WRITE        'w'    /* other writeable        */
  845. #define    COR_TYPE_MSC        '?'    /* other, mapped in segment    */
  846.  
  847. #endif /* TE_I386AIX */
  848.  
  849. /*
  850.  * Local Variables:
  851.  * comment-column: 0
  852.  * End:
  853.  */
  854.  
  855. /* end of coff_gnu.h */
  856.